﻿using System;
using System.Data;
namespace E2_WEBSITE.Code.Admin
{
    public class CompanyInfo
    {
        public string Name { get; set; }
        public string Email { get; set; }
        public string Phone { get; set; }
        public string Address { get; set; }
        public DateTime LastUpdate { get; set; }
        public string UserUpdate { get; set; }
        public string Banner { get; set; }

        public CompanyInfo()
        { }

        static public CompanyInfo Load(DataTable data)
        {
            try
            {
                CompanyInfo company = new CompanyInfo();

                company.Name = data.Rows[0]["CongTy"].ToString();
                company.Email = data.Rows[0]["Email"].ToString();
                company.Phone = data.Rows[0]["DienThoai"].ToString();
                company.Address = data.Rows[0]["DiaChi"].ToString();
                company.LastUpdate = DateTime.ParseExact(data.Rows[0]["NgayCapNhat"].ToString(), Utilities.DateTimeFormatString, null);
                company.UserUpdate = data.Rows[0]["NguoiCapNhat"].ToString();
                company.Banner = data.Rows[0]["Banner"].ToString();

                return company;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}